home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes ƒ / BoxOut wipe.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.1 KB  |  38 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define        BOXES    50    /* increase this for a finer grained but more timely effect */
  4. #define CorrectTime 2
  5. #define theWindowWidth (boundsRect.right-boundsRect.left)
  6. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  7.  
  8. pascal short BoxOutWipe(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  9.  
  10. pascal short BoxOutWipe(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  11. {
  12.     Rect    theRect;
  13.     short        cenx, ceny;
  14.     short        boxnum;
  15.     
  16.     cenx = theWindowWidth / 2;
  17.     ceny = theWindowHeight / 2;
  18.     
  19.     for(boxnum = 0; boxnum <= BOXES; boxnum++)
  20.     {
  21.         StartTiming();
  22.         
  23.         /* this is not the most efficient method, but the overhead of the
  24.         multiplies and the redundant copying is hidden by the timing mechanism */
  25.         theRect.left = cenx - ((boxnum * cenx) / BOXES);
  26.         theRect.right = cenx + ((boxnum * cenx) / BOXES);
  27.         theRect.top = ceny - ((boxnum * ceny) / BOXES);
  28.         theRect.bottom = ceny + ((boxnum * ceny) / BOXES);
  29.         OffsetRect(&theRect, boundsRect.left, boundsRect.top);
  30.         
  31.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  32.                 &theRect, &theRect, 0, 0L);
  33.         TimeCorrection(CorrectTime);
  34.     }
  35.     
  36.     return 0;
  37. }
  38.